#ifndef REGISTERITEMMODEL_H
#define REGISTERITEMMODEL_H

#include <QAbstractTableModel>

class CPU;

class RegisterItemModel : public QAbstractTableModel
{
    Q_OBJECT
public:
    RegisterItemModel(QObject *parent = 0);
    virtual ~RegisterItemModel();
    //
    int rowCount(const QModelIndex &parent = QModelIndex()) const;
    int columnCount(const QModelIndex &parent = QModelIndex()) const;
    QVariant data(const QModelIndex &index, int role) const;
    Qt::ItemFlags flags(const QModelIndex &index) const;
    bool setData(const QModelIndex &index, const QVariant &value, int role);

private slots:
    void updateRegister(int id);

private:
    QVariant getRegistersValue(int index) const;
    QString getRegistersName(int index) const;

private:
    CPU* cpu;
    //
    static const int NUM_OF_COLUMN = 4;
    static const int REGISTER_NAME = 0;
    static const int REGISTER_VALUE_BIN = 1;
    static const int REGISTER_VALUE_HEX = 2;
    static const int REGISTER_VALUE_DEC = 3;
};

#endif // REGISTERITEMMODEL_H
